package com.example.module_service.ui

import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.GridLayoutManager
import com.example.lib_common.base.BaseFragment
import com.example.lib_common.base.BaseViewModel
import com.example.module_service.R
import com.example.module_service.adapter.ServiceAdapter
import com.example.module_service.databinding.FragmentServiceBinding
import com.example.module_service.http.ServiceViewModel
import dagger.hilt.android.AndroidEntryPoint


@AndroidEntryPoint
class ServiceFragment : BaseFragment<BaseViewModel,FragmentServiceBinding>() {
    override val mLayoutResId: Int
        get() = R.layout.fragment_service
    private val mViewModel:ServiceViewModel by viewModels()

    val mAdapter:ServiceAdapter by lazy {
        ServiceAdapter()
    }

    override fun initView() {
        super.initView()
        mViewModel.initList()
        initAdapter()
    }

    override fun initData() {
    }
    override fun initListener() {

    }
    private fun initAdapter() {
        mAdapter.setData(mViewModel.serviceList)
        mBinding.rvService.layoutManager=GridLayoutManager(requireContext(),3)
        mBinding.rvService.adapter=mAdapter
    }

}